<template>
  <div>
    <a-breadcrumb>
      <a-breadcrumb-item>
        <router-link to="/home">首页</router-link>
      </a-breadcrumb-item>
      <a-breadcrumb-item>测试</a-breadcrumb-item>
    </a-breadcrumb>
    <a-card title="GNumberUtils" style="width: 100%;">
      <div>
        age:{{age}}
        <a-button @click="updateAge">updateAge</a-button>
      </div>
      <div>
        price:{{price}}
        <a-button @click="updatePrice">updatePrice</a-button>
      </div>
      <div>
        ages:{{ages}}
        <a-button @click="updateAges">updateAges</a-button>
      </div>
    </a-card>
    <a-card title="GTreeUtils">
      <div>
        tree01
        <a-button @click="updateTree01">updateTree01</a-button>
        <a-tree
          :tree-data="tree01"
          :replaceFields="{children:'children', title:'name', key:'id'}"
        >
          <template #title0010><span style="color: #1890ff">sss</span></template>
        </a-tree>
      </div>
    </a-card>
  </div>
</template>

<script>
import { GNumberUtils, GTreeUtils } from 'great-generator'
export default {
  name: 'test01',
  data () {
    return {
      age: 0,
      price: 0.0,
      ages: [],
      tree01: []
    }
  },
  created () {
    this.age = GNumberUtils.randomInt()
  },
  methods: {
    updateAge () {
      this.age = GNumberUtils.randomInt()
    },
    updatePrice () {
      this.price = GNumberUtils.randomFloat()
    },
    updateAges () {
      this.ages = GNumberUtils.randomInt({ number: 10 })
    },
    updateTree01 () {
      this.tree01 = GTreeUtils.tree()
      console.log(JSON.stringify(this.tree01))
    }
  }
}
</script>

<style scoped>

</style>
